Skip to content

Conversation

@pulpdrew
Copy link
Contributor

@pulpdrew pulpdrew commented Jan 5, 2026

Closes HDX-3094

Summary

This PR standardizes available granularities and inferred/auto granularities throughout the app

  1. A duplicate convertDateRangeToGranularityString implementation was removed.
  2. 10 minute granularity is no longer auto-inferred, because it (in combination with 15 minutes) breaks the property that all granularities are multiples of smaller granularities. Since MVs are only used when the chart granularity is a multiple of the MV granularity, we want to minimize the chance that a MV is 10 minutes and the chart is 15 minutes, or vice versa. To this end, MVs only support 15 minute granularity, and not 10 minute granularity (to align with alerts). By removing the 10 minute granularity from auto granularity inference, we decrease the chance of automatically choosing a granularity that can't be used with an MV.
  3. The max buckets argument was standardized to a constant (DEFAULT_AUTO_GRANULARITY_MAX_BUCKETS) with value 60. It is now an optional argument, only passed when a non-default value is required.

@changeset-bot
Copy link

changeset-bot bot commented Jan 5, 2026

🦋 Changeset detected

Latest commit: d974808

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
hyperdx-v2-oss-app Ready Ready Preview, Comment Jan 12, 2026 4:51pm

@claude
Copy link

claude bot commented Jan 5, 2026

PR Review

✅ No critical issues found.

Minor observations:

  • GranularityPicker.tsx now includes FifteenMinute option (lines 40-42) - consistent with stated goal of standardizing granularities
  • The removal of 10-minute from auto-inference (utils.ts:277) aligns with MV optimization goal, but 10-minute is still available in the picker for manual selection - this is intentional per PR description
  • Default maxNumBuckets constant (60) properly centralized
  • Duplicate code removal successful - single source of truth for convertDateRangeToGranularityString now in common-utils

Changes are well-executed and consistent with the stated objectives.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

E2E Test Results

1 test failed • 59 passed • 4 skipped • 744s

Status Count
✅ Passed 59
❌ Failed 1
⚠️ Flaky 0
⏭️ Skipped 4

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew pulpdrew force-pushed the drew/standardize-granularities branch from 8f01199 to 1cc78a6 Compare January 5, 2026 16:24
@pulpdrew pulpdrew force-pushed the drew/standardize-granularities branch from a6ab41e to 2038ea6 Compare January 5, 2026 17:28
@pulpdrew pulpdrew requested review from a team and wrn14897 and removed request for a team January 5, 2026 17:57
@pulpdrew pulpdrew force-pushed the drew/standardize-granularities branch from 2038ea6 to 7321b64 Compare January 6, 2026 16:35
kodiakhq bot pushed a commit that referenced this pull request Jan 7, 2026
…#1533)

Closes HDX-3067
Closes #1331 
Closes #1212 
Closes #1468

# Summary

This PR makes a number of improvements around the way we handle date ranges and granularities, in an effort to minimize discrepancies between aggregate values queried from original data and aggregate values queried from materialized views.

1. Date ranges for Line and Bar chart queries are now (by default) auto-aligned to the chart's granularity. **This is not limited to materialized view queries.** Since the chart granularity is a multiple of the MV granularity, this ensures that the date range is aligned to the MV granularity as well. This also address a number of related issues that point out 0-values or low-values in the first or last data points. This PR also includes an option to disable this behavior for charts in Chart Explorer or Dashboard Tiles.
2. All materialized view queries and all time chart queries are now end-exclusive, to avoid selecting the entirety of the next "time bucket" from the materialized view when the date range is aligned with the materialized view granularity
3. Materialized views are only used for a query with a granularity if the chart query granularity is a multiple of the MV granularity. Previously, we'd use the MV as long as the chart query granularity was at least as large as the MV granularity, but this could cause unequal distributions of data across time buckets. Nearly all available granularities are multiples of all smaller available granularities - so this should only impact queries with granularity 15 minutes with MVs with granularity 10 minutes. 10m granularity support is being removed in #1551 

## Demo

<details>
<summary>Show Complete Intervals Option</summary>

https://github.com/user-attachments/assets/4b903adb-4edf-4481-93d6-2a0c42589a37
</details>
@pulpdrew pulpdrew force-pushed the drew/standardize-granularities branch from 7321b64 to 1947e1f Compare January 8, 2026 22:01
Copy link
Member

@wrn14897 wrn14897 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kodiakhq kodiakhq bot merged commit 79398be into main Jan 12, 2026
11 of 12 checks passed
@kodiakhq kodiakhq bot deleted the drew/standardize-granularities branch January 12, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants